package com.voole.dao;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.mapping.StatementType;
import org.springframework.stereotype.Repository;

import com.voole.entity.SysAuthority;
import com.voole.entity.SysRole;
import com.voole.entity.SysRoleAction;
import com.voole.entity.SysUser;

@Repository
public interface SysRoleActionDao {

	@Select(value="SELECT * FROM sys_role_action WHERE roleid = ${roleId}")
	List<SysRoleAction> getList(@Param(value="roleId")Integer roleId);
	
	@Select(value="SELECT actionid FROM sys_role_action WHERE roleid = ${roleId}")
	List<Integer> getActionIdList(@Param(value="roleId")Integer roleId);
	
	@Insert("INSERT INTO sys_role_action (`roleid`, `actionid`) VALUES(#{roleid}, #{actionid})")  
	@Options(useGeneratedKeys = true, keyProperty = "id")
	Integer addSysRoleAction(SysRoleAction roleAction);
	
	@Delete(value="delete from sys_role_action where roleid = #{roleId}")
	Integer delSysRoleAction(Integer roleId);
}